package Models;

import java.util.Calendar;
import java.util.Date;

public class Firkins {
    private int firkinID;
    private String firkinDescription;
    private BrewView firkinBatchID;
    private String firkinRecipe;
    private String firkinResults;
    private boolean firkinSold;
    private double firkinVolume;
    private Date firkinDate;
    private CustomerView firkinCustomerID;
    private Date firkinSalesDate;
    private double firkinCost = 100;
    
	public int getFirkinID() {
		return firkinID;
	}
	public void setFirkinID(int firkinID) {
		this.firkinID = firkinID;
	}
	public String getFirkinDescription() {
		return firkinDescription;
	}
	public void setFirkinDescription(String firkinDescription) {
		this.firkinDescription = firkinDescription;
	}
	public BrewView getFirkinBatchID() {
		return firkinBatchID;
	}
	public void setFirkinBatchID(BrewView firkinBatchID) {
		this.firkinBatchID = firkinBatchID;
	}
	public String getFirkinRecipe() {
		return firkinRecipe;
	}
	public void setFirkinRecipe(String firkinRecipe) {
		this.firkinRecipe = firkinRecipe;
	}
	public String getFirkinResults() {
		return firkinResults;
	}
	public void setFirkinResults(String firkinResults) {
		this.firkinResults = firkinResults;
	}
	public boolean isFirkinSold() {
		return firkinSold;
	}
	public void setFirkinSold(boolean firkinSold) {
		this.firkinSold = firkinSold;
	}
	public double getFirkinVolume() {
		return firkinVolume;
	}
	public void setFirkinVolume(double firkinVolume) {
		this.firkinVolume = firkinVolume;
	}
	public Date getFirkinDate() {
		return firkinDate;
	}
	public void setFirkinDate(Date firkinDate) {
		this.firkinDate = firkinDate;
	}
	public CustomerView getFirkinCustomerID() {
		return firkinCustomerID;
	}
	public void setFirkinCustomerID(CustomerView firkinCustomerID) {
		this.firkinCustomerID = firkinCustomerID;
	}
	public Date getFirkinSalesDate() {
		return firkinSalesDate;
	}
	public void setFirkinSalesDate(Date firkinSalesDate) {
		this.firkinSalesDate = firkinSalesDate;
	}
	public double getFirkinCost() {
		return firkinCost;
	}
	public void setFirkinCost(double firkinCost) {
		this.firkinCost = firkinCost;
	}

    public Date getDueDate(final int term) {
            final Calendar cal = Calendar.getInstance();
            cal.setTime(this.firkinSalesDate);
            cal.add(Calendar.DATE, term);
            return new Date(cal.getTime().getTime());
    }
    
    public String getDisplayID() {
            final String mask = "firk000000";
            final String ds = Integer.toString(this.firkinID);
            return mask.substring(0, mask.length() - ds.length()) + ds;
    }
    
    public String getDisplayString(){
    	return Integer.toString(this.firkinID) + ": " + this.firkinDescription;
    }
}
